#include <game/ScreenReferenceDefinition.h>
#include <game/ScreenReference.h>
#include <game/Screen.h>
#include <game/ScreenDefinition.h>
#include <game/ResourceReferenceDefinition.h>

#include <game/StaticResourceScreenReference.h>
#include <Gluck.h>
#include <resource/Manager.h>
#include <xml/Stream.h>

ARELLO_GAME_NAMESPACE_DECL_START

ScreenReferenceDefinition::ScreenReferenceDefinition()
{
}

ScreenReferenceDefinition::~ScreenReferenceDefinition()
{
}

bool ScreenReferenceDefinition::on_node( xml::Provider * prov, const std::string & name )
{
	if (name == "Resource")
	{
		ResourceReferenceDefinition def;
		if (!prov->parse_object(def.GetLoader()))
			return false;
	
		this->reference.reset(new StaticResourceScreenReference(def.GetPath()));
		return true;
	}

	return false;
}

ARELLO_GAME_NAMESPACE_DECL_END